package com.ppc.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.github.houbb.sensitive.word.bs.SensitiveWordBs;
import io.swagger.annotations.ApiModel;
import java.time.LocalDateTime;
import lombok.Data;

/**
 * 雇主需求
 *
 * @author LENOVO
 * @date 2023/12/20
 */
@Data
@ApiModel(description = "雇主需求")
public class EmployerRequirementDTO {

  /**
   * 需求金额
   */
  private Float requireAmount;
  /**
   * 需求的宽泛描述
   */
  private String requireBroadDesc;
  /**
   * 需求截止时间
   */
  @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
  private LocalDateTime requireDeadline;
  /**
   * 需求详细描述
   */
  private String requireDetailDesc;
  /**
   * 需求期望人数
   */
  private Integer requirePeopleNum;
  /**
   * 需求标签
   */
  private String requireTag;
  /**
   *
   */
  private String requireTitle;
  /**
   * 敏感词
   */
  private String sensitiveWord;

  public boolean checkSensitive() {
    SensitiveWordBs sensitiveWordBs = SensitiveWordBs.newInstance();
    if (sensitiveWordBs.contains(requireBroadDesc)) {
      sensitiveWord=sensitiveWordBs.findFirst(requireBroadDesc);
      return true;
    } else if (sensitiveWordBs.contains(requireDetailDesc)) {
      sensitiveWord=sensitiveWordBs.findFirst(requireDetailDesc);
      return true;
    } else if (sensitiveWordBs.contains(requireTitle)) {
      sensitiveWord=sensitiveWordBs.findFirst(requireTitle);
      return true;
    } else {
      return false;
    }
  }
}
